﻿@{
    ViewBag.Title = "UpdatePassword";
}
@using WeiXinWeb.Models;
@model TruckCompany

@section script{
  <script type="text/javascript">
    $(function () {
        message();
        $("#update").click(function () {
            var p = $("#password");
            var p1 = $("#passwords");
            if ($.trim(p.val()) == "") {
                noty({ text: "新密码不允许为空！" });
            
                p.focus();
                return false;
            }
            if ($.trim(p1.val()) == "") {
                noty({ text: "确认密码不允许为空！" });
                p1.focus();
                return false;
            }
            if (p.val() != p1.val()) {
                noty({ text: "两次密码输入不一致！" });
                p.focus();
                return false;
            }
            $.mobile.loading("show", {
                text: "操作中....",
                textVisible: true,
                theme: "b"
            });
            $.post("/User/UpdatePassword", { password: p.val() }, function (data) {
                if (data != null) {
                    $.mobile.loading("hide");
                    if (data != "") {
                        noty({ text: data });
                    }
                    else {
                        $("#popupDialog").popup("open");
                    }

                }
            })
        });

    });
</script>
}
<style type="text/css">
    .custom-corners .ui-bar {
        -webkit-border-top-left-radius: inherit;
        border-top-left-radius: inherit;
        -webkit-border-top-right-radius: inherit;
        border-top-right-radius: inherit;
    }

    .custom-corners .ui-body {
        border-top-width: 0;
        -webkit-border-bottom-left-radius: inherit;
        border-bottom-left-radius: inherit;
        -webkit-border-bottom-right-radius: inherit;
        border-bottom-right-radius: inherit;
    }
</style>

<div data-role="page">
    <div data-role="header" >
    @{
        var del = ViewBag.Isdefault;
        if (del==null||del != "def")
        { 
          <a href="#" data-rel="back" data-icon="back" data-theme="b">返回</a>
        }
    }
    <h1>修改密码</h1>
    </div>
    <div data-role="content">
       @{
           if (del == null || del != "def")
           {

           }
           else
           { 
               <div id="reminder" class="ui-corner-all custom-corners">
                    <div class="ui-bar ui-bar-a">
                        <h3>
                            提示:<lable style="color:red">*系统要求用户首次登陆需修改密码！</lable>
                        </h3>
                    </div>
                </div>
           }
            var models = (TruckCompany)@ViewBag.tc;
            <div data-role="fieldcontain"> 
                <label for="ower" style="float:left">车  主 :</label>
                <label id="ower" style="font-weight:bold">@models.owner</label>
            </div>
            <div data-role="fieldcontain"> 
                <label for="tel" style="float:left">手 机 号:</label>
                <label style="font-weight:bold">@models.tel</label>
            </div>
         }
            <label for="password">新 密 码:</label>
            <input type="password" id="password" data-clear-btn="true" />
            <label for="passwords">确认密码:</label>
            <input type="password" id="passwords" data-clear-btn="true" />
           <input type="button" id="update" value="修改" style="background-color:blanchedalmond" />
    </div>
    <div data-role="popup" id="popupDialog" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width:400px;">
        <div data-role="header" data-theme="a">
            <h1>提示</h1>
        </div>
        <div role="main" class="ui-content">
            <h3 class="ui-title" id="alert">修改密码成功！</h3>
            <a href="/Common/Dialog" style="background-color:blanchedalmond" target="_self" class="ui-btn ui-corner-all ui-shadow ui-btn-a">确定</a>
        </div>
    </div>
</div>
